package com.hyt.it.ogt.kq.service.admission;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hyt.it.ogt.kq.service.gov.feign.ks.model.KwExamCandidateVO;
import com.hyt.it.ogt.kq.service.model.entity.Candidate;
import com.hyt.it.ogt.kq.service.model.entity.admission.ExamineeInfo;
import com.hyt.it.ogt.kq.service.gov.model.param.admission.ExamineeInfoExportParam;
import com.hyt.it.ogt.kq.service.gov.model.param.admission.ExamineeInfoPageParam;
import com.hyt.it.ogt.kq.service.gov.model.param.admission.ExamineeTicketViewPageParam;
import com.hyt.it.ogt.kq.service.gov.model.vo.admission.AdmissionQueryVO;
import com.hyt.it.ogt.kq.service.gov.model.vo.admission.ExamineeInfoPageVO;
import com.hyt.it.ogt.kq.service.gov.model.vo.admission.ExamineeInfoVO;
import com.hyt.loginfo.model.User;

import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 准考证考生信息
 * </p>
 *
 * @author zhoumiao
 * @since 2023-01-10
 */
public interface IExamineeInfoService extends IService<ExamineeInfo> {

    String PRE_VIEW = "预览";
    String ZIP_SUFFIX = "zip";
    String IMAGE_SUFFIX = ".jpg";

    String HTML_SUFFIX = ".html";

    String ID_NO_REGEX = "[A-Za-z0-9()]+";

    /**
     * 前端纵向rowType类型
     */
    String VERTICAL_TYPE = "vertical";

    /**
     * 前端模板参数行类型参数名
     */
    String ROW_TYPE = "rowType";

    /**
     * 前端模板参数行遍历行参数名
     */
    String EACH_NAME = "eachName";

    /**
     * 前端模板参数获取列表
     */
    String TEMPLATE_PARAM_LIST = "dataList";

    /**
     * 前端模板列参数名
     */
    String COLUMN = "column";

    /**
     * 前端模板列Code参数名
     */
    String CODE = "code";

    /**
     * 考生分页列表接口
     *
     * @param examineeInfoPageParam
     * @return
     */
    IPage<ExamineeInfoPageVO> pageExamineeInfo(ExamineeInfoPageParam<?> examineeInfoPageParam);

    /**
     * 取消生成准考证
     *
     * @param examineeInfoId
     * @return
     */
    Boolean cancelGenerate(String examineeInfoId);

    /**
     * 批量取消生成准考证
     *
     * @param admissionTicketInfoId
     * @return
     */
    Boolean batchCancelGenerate(String admissionTicketInfoId);

    /**
     * 同步虚拟考场考生和配置
     *
     * @param examId
     * @param currentUser
     * @param admissionTicketTaskId
     */
    void syncGov(String examId, String currentUser, String admissionTicketTaskId);

    /**
     * 同步无考场考生和配置
     *
     * @param examId
     * @param currentUser
     * @param admissionTaskId
     * @param deptId
     */
    void syncKw(String examId, User currentUser, String admissionTaskId, String deptId);

    /**
     * 无考场新增单个考生
     *
     * @param kwExamCandidateVO
     * @param currentUser
     */
    void insertByKw(KwExamCandidateVO kwExamCandidateVO, String currentUser);

    /**
     * 无考场删除单个考生
     *
     * @param kwExamCandidateVO
     * @param currentUser
     */
    void deleteByKw(KwExamCandidateVO kwExamCandidateVO, String currentUser);

    /**
     * 无考场和虚拟考场更新单个考生
     *
     * @param kwExamCandidateVO
     * @param currentUser
     */
    void updateByKw(KwExamCandidateVO kwExamCandidateVO, String currentUser);

    /**
     * 考务新增单个考生
     *
     * @param candidate
     * @param currentUser
     */
    void insertByGov(Candidate candidate, String currentUser);

    /**
     * 考务删除单个考生
     *
     * @param candidate
     * @param currentUser
     */
    List<ExamineeInfo> deleteByGov(Candidate candidate, String currentUser);

    /**
     * 考务更新单个考生
     *
     * @param candidate
     * @param currentUser
     */
    void updateByGov(Candidate candidate, String currentUser);

    /**
     * 删除学生
     *
     * @param currentUser
     * @param now
     * @param examineeIds
     */
    List<ExamineeInfo> delete(String currentUser, LocalDateTime now, List<String> examineeIds);

    /**
     * 导入考生照片
     *
     * @param admissionTicketInfoId
     * @return
     */
    void importAdmissionTicketPhoto(String zipFileUrl, String admissionTicketInfoId);

    /***
     * 根据考生姓名和考证证件号码查询准考证
     * @param queryName
     * @param queryNumber
     * @return
     */
    AdmissionQueryVO queryByNameAndIdCardNo(String admissionTicketInfoId, String queryName, String queryNumber);

    /***
     * 下载准考证
     * @param admissionTicketInfoId 准考证id
     * @param id 考生id
     * @return
     */

    String downloadByNameAndIdCardNo(HttpServletResponse response, String admissionTicketInfoId, String id);


    /****
     * 准考证查询记录列表
     * @param officeid
     * @param examineeTicketViewPageParam
     * @return
     */
    <E extends IPage<ExamineeInfoVO>> E queryTicketViewList(String officeid, E pageParam, ExamineeTicketViewPageParam examineeTicketViewPageParam);

    /**
     * 查询是否准考证任务是否已经生成准考证
     *
     * @param admissionTicketInfoId
     * @return
     */
    boolean isGeneratedTicket(String admissionTicketInfoId);

    /**
     * 通过准考证id删除考生数据
     *
     * @param admissionTicketInfoId
     * @param currentUser
     * @param deptId
     */
    void deleteByAdmissionTicketId(String admissionTicketInfoId, User currentUser, String deptId);

    /**
     * 生成准考证
     *
     * @param examineeInfoId
     * @return
     */
    Boolean generateAdmissionTicket(String examineeInfoId);

    /**
     * 生成考生批次准考证
     *
     * @param examineeTimeId
     * @return
     */
    Boolean generateExamineeTimeAdmissionTicket(String examineeTimeId);

    /**
     * 取消生成考生批次准考证
     *
     * @param examineeTimeId
     * @return
     */
    Boolean cancelExamineeTimeGenerate(String examineeTimeId);

    /**
     * 查询导出查询考生准考证信息
     *
     * @param examineeInfoExportParam
     * @return
     */
    List<ExamineeInfoPageVO> exportAdmissionTicketExcelSingle(ExamineeInfoExportParam examineeInfoExportParam);

    /**
     * 学生数量
     *
     * @param admissionId
     * @return
     */
    Integer examineeCount(String admissionId);

    /**
     * 已经生成的准考证数量
     *
     * @param admissionId
     * @return
     */
    Integer ticketGeneratedCount(String admissionId);

    /**
     * 未生成准考证的数量
     *
     * @param admissionId
     * @return
     */
    Integer ticketNotGenerateCount(String admissionId);

    /**
     * 通过准考证任务id查询
     *
     * @param admissionId
     * @return
     */
    List<ExamineeInfo> listByAdmissionId(String admissionId);

    /**
     * 预览准考证
     *
     * @param examineeInfoId 考生信息ID
     * @return
     */
    String preview(String examineeInfoId);
}
